<template>
  <a-spin :spinning="spinning">
    <iframe  :id="id" :src="url"  frameborder="0" style="width: 100%" scrolling="auto"  ></iframe>
  </a-spin>
</template>

<script>
  import { concatUrl,randomUUID} from "../../utils/util";
  import {appApiBaseUrl} from '../../config/constant.config';
  export default {
    name: "EditModelModal",
    data () {
      return {
        url: "",
        id:randomUUID(),
        spinning:false,
      }
    },
    mounted(){
      let height = document.body.clientHeight;
      let iframe = document.getElementById(this.id);
      iframe.style.height= (height -120)+"px";
      this.spinning = true;
      let that = this;
      iframe.onload = ()=>{
        console.log(that.spinning);
        if(that.spinning ===  true){
          that.spinning = false;
        }else{
          that.$emit('removeCurrentPage');
          // this.$router.go(-1);
        }

      }
      this.createUrl();
    },
    methods: {
      createUrl () {
        let u = this.$route.query.modelId||'';
        this.url = concatUrl(appApiBaseUrl, "/activiti/modeler.html")+"?modelId="+u;
      },
    }
  }
</script>

<style>
</style>